package com.netease.evo.service.impl;

import com.netease.evo.dto.CourseDto;
import com.netease.evo.service.CourseService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @Package: com.netease.evo.service.impl
 * @Description: java类作用描述
 * @Author: rayduan
 * @CreateDate: 2021/11/24 10:47 上午
 * @Version: 1.0
 * <p>
 */
@Service
public class CourseServiceImpl implements CourseService {

    @Override
    public CourseDto getById(Integer id) {
        return CourseDto.builder().id(id).name("数学").build();
    }

    @Override
    public List<CourseDto> getByUserId(Integer userId) {
        if(userId.equals(1)){
            return Stream.of(CourseDto.builder().id(1).name("数学").build()).collect(Collectors.toList());
        }else {
            return Stream.of(CourseDto.builder().id(2).name("语文").build()).collect(Collectors.toList());
        }
    }
}
